package com.acme.ionio;

import com.acme.ionio.impl.FileCopierIO;
import org.apache.log4j.Logger;

import java.io.File;
import java.io.IOException;

/**
 * @author Gregory Sobko
 */
public class MainLocal {

    private static Logger logger = Logger.getLogger(MainLocal.class);

    public static void main(String... args) {
        if(args.length < 2){
            logger.error("Not enough arguments: specify from to");
            return;
        }
        long start = System.currentTimeMillis();
        String from = args[0];
        String to = args[1];
        FileCopier fileCopier = new FileCopierIO();
        try {
            fileCopier.copy(new File(from), new File(to));
        } catch (IOException e) {
            logger.error("Cannot copy file!:" + e.getMessage());
        }
        logger.info("Time consumed: " + (System.currentTimeMillis() - start) + " ms");
    }
}
